<!DOCTYPE html>
<html lang="en"> 
	<head>
		<meta charset="utf-8" />
		<title><?php if (isset($title)){echo $title;}?></title>
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<!-- basic styles -->
                 <base href="<?php echo base_url() ?>" />
		<link href="assets/css/bootstrap.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="assets/css/font-awesome.min.css" />
		<!--[if IE 7]>
		  <link rel="stylesheet" href="assets/css/font-awesome-ie7.min.css" />
		<![endif]-->
		<!-- page specific plugin styles -->
		<link rel="stylesheet" href="assets/css/jquery-ui-1.10.3.full.min.css" />
		<link rel="stylesheet" href="assets/css/datepicker.css" />
		<link rel="stylesheet" href="assets/css/ui.jqgrid.css" />
		<!-- fonts -->
		<!--<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:400,300" /> -->
		<!-- ace styles -->
		<link rel="stylesheet" href="assets/css/ace.min.css" />
		<link rel="stylesheet" href="assets/css/ace-rtl.min.css" />
		<link rel="stylesheet" href="assets/css/ace-skins.min.css" />
		<!--[if lte IE 8]>
		  <link rel="stylesheet" href="assets/css/ace-ie.min.css" />
		<![endif]-->
		<!-- inline styles related to this page -->
		<!-- ace settings handler -->
		<script src="assets/js/ace-extra.min.js"></script>
		<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
		<!--[if lt IE 9]>
		<script src="assets/js/html5shiv.js"></script>
		<script src="assets/js/respond.min.js"></script>
		<![endif]-->
	</head>
        <body> 
     <div class="col-xs-12 ">
        <div class="widget-box">
                <div class="widget-header">
                        <h5>请选择添加项目</h5>
                        <div class="widget-toolbar">
                                <a data-action="collapse" href="#">
                                        <i class="icon-chevron-up"></i>
                                </a>                               
                        </div>
                </div>                  												
                <div class="widget-body">
                  <div class="widget-main">
                      <form id="myform" name="myform" method="post" action="">
                        <table width="99%" align="center"class="table table-bordered table-hover table-condensed m10">
                          <tr bgcolor="#FFFFFF">
                              <td width="8%"  bgcolor="#FFFFFF"><div align="center"><label><input class="ace" type="checkbox" id="chb0" value="NULL"><span class="lbl"></span></label></div></td>
                            <td width="15%" bgcolor="#FFFFFF"><div align="center"><b>项目编码</b></div></td>
                            <td bgcolor="#FFFFFF" ><div align="center"><b>项目名称</b></div></td>
                            <td  width="14%" bgcolor="#FFFFFF"><div align="center"><b>项目经理</b></div></td>
                            <td  width="10%" bgcolor="#FFFFFF"><div align="center"><b>建设年度</b></div></td>
                            <td  width="10%"bgcolor="#FFFFFF"><div align="center"><b>是否在建</b></div></td>
                          </tr>
                         <?php  $num=0;if(isset($proiect)){foreach ($proiect->result() as $row) : ?>
                          <tr bgcolor="#FFFFFF">
                             <td bgcolor="#FFFFFF"><div align="center"><label><input class="ace" type="checkbox" value="<?php echo $row->pcode ?>"id="<?php echo 'chb'.($num+1) ?>"><span class="lbl"></span></label></div> </td>
                             <td bgcolor="#FFFFFF"><div align="center"><?php echo $row->pcode ?></div></td>
                            <td bgcolor="#FFFFFF"><div align="center"><?php echo $row->pname ?></div></td>
                            <td bgcolor="#FFFFFF"><div align="center"><?php echo $row->name ?></div></td>
                            <td bgcolor="#FFFFFF"><div align="center"><?php echo $row->pyear ?>年</div></td>
                            <td bgcolor="#FFFFFF"><div align="center"><?php if( $row->constructionState){echo "是" ;}else{ echo "否";}?></div></td>
                          </tr>
                         <?php $num++; endforeach; } ?>
                          <tr bgcolor="#FFFFFF">
                            <td colspan="6">
                              <span id="msgs" style="color:red"><div id="msgs" style="margin-top:12px;margin-bottom:5px;font-size:13px;color:red;">共用了{elapsed_time}秒查询到<?php echo $num?>条记录。</div></span>    </td>
                            </tr>
                              <tr bgcolor="#FFFAFA">
                                <td colspan="6" align="center">
                                <input type="hidden" name="pcode_addrst"id="pcode_addrst" />
                                <?php if($num!=0){?>
                                <button class="btn btn-info" type="button" id="AddPcodeBtn">
                                        <i class="icon-plus-sign bigger-110"></i>
                                      添加项目
                                </button>
                                <?php }?>
                                &nbsp; &nbsp; &nbsp;
                                <button class="btn" type="button"id="Gobck">
                                        <i class="icon-arrow-left bigger-110"></i>
                                       返回
                                </button>

                                </td>
                           </tr>
                        </table>
                        </form>  
                     </div>
                    </div>
                </div>
            </div><!-- /span -->                
      <!-- basic scripts -->
		<!--[if !IE]> -->
		<script src="assets/js/jquery-2.0.3.min.js"></script>
		<!-- <![endif]-->
		<!--[if IE]>
                <script src=assets/js/jquery-1.10.2.min"></script>
                <![endif]-->
		<!--[if !IE]>
		<script type="text/javascript">
			window.jQuery || document.write("<script src='assets/js/jquery-2.0.3.min.js'>"+"<"+"/script>");
		</script>
		<![endif]-->
		<!--[if IE]>
                <script type="text/javascript">
                 window.jQuery || document.write("<script src='assets/js/jquery-1.10.2.min.js'>"+"<"+"/script>");
                </script>
                <![endif]-->
		<script type="text/javascript">
			if("ontouchend" in document) document.write("<script src='assets/js/jquery.mobile.custom.min.js'>"+"<"+"/script>");
		</script>
		<script src="assets/js/bootstrap.min.js"></script>
		<script src="assets/js/typeahead-bs2.min.js"></script>
                <script src="assets/js/date-time/bootstrap-datepicker.min.js"></script>
                <script src="assets/js/jquery-ui-1.10.3.custom.min.js"></script>
		<script src="assets/js/jquery.ui.touch-punch.min.js"></script>
		<script src="assets/js/chosen.jquery.min.js"></script>
		<script src="assets/js/fuelux/fuelux.spinner.min.js"></script>
                <script src="assets/js/bootstrap-modal.js"></script>      
		<script src="assets/js/date-time/bootstrap-datepicker.min.js"></script>
		<script src="assets/js/date-time/bootstrap-timepicker.min.js"></script>
		<script src="assets/js/date-time/moment.min.js"></script>
		<script src="assets/js/date-time/daterangepicker.min.js"></script>
		<script src="assets/js/bootstrap-colorpicker.min.js"></script>
		<script src="assets/js/jquery.knob.min.js"></script>
		<script src="assets/js/jquery.autosize.min.js"></script>
		<script src="assets/js/jquery.inputlimiter.1.3.1.min.js"></script>
		<script src="assets/js/jquery.maskedinput.min.js"></script>
		<script src="assets/js/bootstrap-tag.min.js"></script>
                <script src="assets/js/layer/layer.min.js"></script>
		<!-- ace scripts -->
		<script src="assets/js/ace-elements.min.js"></script>
		<script src="assets/js/ace.min.js"></script>
                <script type="text/javascript">                     
                   $('#chb0').on('click' , function(){
                         var that = this;
                        $(this).closest('table').find('tr > td:first-child input:checkbox').each(function(){
                                this.checked = that.checked;
                                $(this).closest('tr').toggleClass('selected');
                        });
                     }); 
                    $('#Gobck').click(function(){
                        layer.load('请稍候。。。', 3);
                        history.back();
                    });
                    $('#AddPcodeBtn').click(function(){
                        var num=0;
                        var str_val="",str_last="";
                       $(":checked").each(function () {  //遍历选中的元素
                           if($(this).val()!="NULL"){
                             num++;
                             str_val+=$(this).val()+",";                                               
                           }//endif
                       }); //end each 
                      str_last=str_val.substring(0,(str_val.length-1));
                     $('#pcode_addrst').val(str_last);
                     if(num==0){
                        layer.alert("请至少选择一条添加!",5);    
                     }else{
                       layer.alert(num+"条项目添加成功，请关闭本窗口返回。",1); 
                       }                   
                    });
              </script>
           </body>
      </html>    